$(document).ready(function() {
  require(["inputdrop", "asset"], function(inputdrop, asset) {
    var list_col = [
      { name: "", text: "", hideSearch: "hide", width: 3 },
      { text: "管控域名称", name: "name", align: "left", width: 15,tip:true },
      {
        text: "部署网络",
        name: "networkName",
        align: "left",
        width: 15,
        searchRender: function(el) {
          el.append(
            '<input type="text" class="form-control input-sm" search-data="userName">'
          );
        }
      },
      { text: "服务地址", name: "uri", align: "left", width: 10,tip:true },
     
      {
        text: "建设时间",
        name: "buildingTime",
        align: "left",
        width: 15,
        render: function(text) {
          return text?new Date(text).Format("yyyy-MM-dd"):"";
        }
      }
    ];
  

    event_init();

    user_list({ paramObj: null, isLoad: true, maskObj: "body" });

    index_search_div_remove_click(user_list, {
      paramObj: null,
      isLoad: true,
      maskObj: "body"
    });

    function event_init() {
      $('input[placeholder]').placeholder()
      $("#add_btn").click(function() {
        edit_template_init();
      });
      $("#searchIcon").click(function() {
        
        var key=$("#searchKey").val()
        user_list({
          paramObj: {systemName:key},
          isLoad: true,
          maskObj: "body"
        });
      });
      $("#searchKey").keydown(function(event) {
        if (event.keyCode == 13 ) {
          
          $("#searchIcon").trigger("click");
        }
      });
      $("#sec_setting_btn").click(function() {
        sec_setting_template_init();
      });

      asset.user_init();
    }

    function user_list(option) {
      g_grid.render($("#table_div"), {
        header: list_col,
        url: "api/systemMonitor/getSysReginfList",
        type: "xd",
        dataKey: "list",
        hasBorder:false,
        hideSearch : true,
        paramObj: option.paramObj,
        isLoad: option.isLoad,
        maskObj: option.maskObj,
        dbClick: detail_template_init,
        dbIndex: 1,
        autoHeight : true,
        showCount : true,
        allowCheckBox:false
      });
    }

 

 

    function detail_template_init(rowData) {
      
      window.location.hash="#/base_resource_mant/control_domain_hash_edit?id="+rowData.sysId
    }

  });
});
